﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebSite.Master" AutoEventWireup="true" CodeBehind="EnterpriseCorpList1.aspx.cs" Inherits="RN.ERP.Web.Enterprise.EnterpriseCorpList1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="Stylesheet" type="text/css" href="../Scripts/ligerUI/skins/Aqua/css/ligerui-all.css" />
    <script type="text/javascript" src="../Scripts/ligerUI/js/ligerui.min.js"></script>
    <script type="text/javascript" src="../Scripts/EnterpriseCorpList.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#btnSearch").click(function () {
                $("#<%= hdnCondition.ClientID %>").val("");
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
            }
    );
            $("#btnSeniorSearch").click(function () {
                var classId = $("#<%= hdnClassID.ClientID %>").val();
                $.ligerDialog.open({ url: '../Enterprise/EnterpriseSeniorSearch.aspx?ClassID=' + classId, width: 560, height: 500, buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            }
    );
            $("#<%= ddlStatus.ClientID %>").change(function () {
                $("#<%= hdnCondition.ClientID %>").val("");
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
            }
        );
        }
);

        function AuditCorp(opt) {
            var chk = $("input:checked");
            if (chk.length == 0) {
                $.ligerDialog.warn("请选择要审核的企业！");
                return false;
            }
            if (chk.length > 1) {
                $.ligerDialog.warn("请选择一家企业进行审核！");
                return false;
            }
            radconfirm('确定审核企业信息？', Post, 300, 150, null, '提示');
            return false;
            function Post(arg) {
                if (arg) {
                    var guid = chk.attr("value").split(';')[0];
                    $.getJSON("../Handlers/EnterpriseCorpInfoHandler.ashx", { "action": "AuditCorp", "data": guid, "opt": opt, "content": "", "rand": Math.random() }, function (data) {
                        $.ligerDialog.warn(data.Message);
                        $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
                    }
            );
                }
            }
        }
        function CheckSel() {
            var chk = $("input:checked");
            if (chk.length == 0) {
                $.ligerDialog.warn("请选择要查看的企业！");
                return false;
            }
            if (chk.length > 1) {
                $.ligerDialog.warn("请选择一家企业进行查看！");
                return false;
            }
            var guid = chk.attr("value").split(';')[0];
            $.ligerDialog.open({ url: "Enterprise/EnterpriseCorpInfo.aspx?corpUserGuid=" + guid, width: 1180, height: 800, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            //  window.location.href = '../Enterprise/EnterpriseCorpInfo.aspx?corpUserGuid=' + guid;
        }
        function ShowCorpView(corpGuid) {
            var classId = $("#<%=hdnClassID.ClientID %>").val();
            top.ChildDialogWin = window;
            top.ChildDialog = top.$.ligerDialog.open({ url: "Enterprise/EnterpriseCorpAllInfo.aspx?corpUserGuid=" + corpGuid + "&classId=" + classId, width: 1190, height: 880, title: '', buttons: [{ text: '关闭', onclick: function (item, dialog) { dialog.close(); } }] });
            top.setChildDialogClose(this, "RefreshGrid");
            //  window.location.href = '../Enterprise/EnterpriseCorpInfo.aspx?corpUserGuid=' + guid;
        }
        function RefreshGrid(condition) {
            $("#<%= hdnCondition.ClientID %>").val(condition);
            $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }

        function Refresh(type) {
            ////刷新最上方的工具栏
            //        alert('123');
            //        var mainFrame = parent.$("#userInfoTop").attr('src');
            //        alert(mainFrame);
            //        alert('456');
            var tabs = top.tab.getTabidList("", "");
            for (var i = 0; i < tabs.length; i++) {
                top.tab.reload(tabs[i]);
            }
            if (type != null && type != "" && type == "Add") {
                //window.location.href = "../Enterprise/EnterpriseCorpInfo.aspx";
                top.tab.addTabItem({ tabid: new Date().getTime(), text: "企业信息管理", url: "Enterprise/EnterpriseCorpInfo.aspx" });
            }

        }
    </script>
    <script type="text/javascript">
        /*锁定解锁企业*/
        var corpFlag = 0;
        var userGuid = "";
        var areaCode = "<%=AreaCode %>";
        function SetCorpbCanBid(eflag, CorpUserGuid) {
            corpFlag = eflag;
            userGuid = CorpUserGuid;
            OpenConfirm('请确定要执行此操作？', CorpbCanCallBackFn);
            return false;
        }
        function CorpbCanCallBackFn(arg) {
            if (arg) {
                $.getJSON("../Handlers/EnterpriseCorpInfoHandler.ashx", { "action": "CorpbCanBid", "corpUserGuid": userGuid, "areaCode": areaCode, "corpFlag": corpFlag, "rand": Math.random() }, function (data) {
                     $.ligerDialog.warn(data.Message);
                    RefreshGrid("");
                });
            }
        }
        function OpenConfirm(text, confirmCallBackFn) {
            $.ligerDialog.confirm(text, '', confirmCallBackFn);
            return false;
        }
    </script>
    <style type="text/css">
        .text_css
        {
            border: 2px;
            height: 24px;
            line-height: 24px;
            margin-top: 8px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="ListCorps" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" style="table-layout:fixed;">
        <tr>
            <td class="xx_m  tt_xx_l"></td>
            <td class="xx_m  tt_xx_icon"></td>
            <td style="width:auto;" class="xx_m">企业列表</td>
            <td style="width:14px;"><img src="../images/xx_r.jpg" width="14" height="33" /></td>
        </tr>
        <tr>
            <td class="left_con">
                &nbsp;
            </td>
            <td colspan="2" style="padding-left: 6px; padding-right: 6px;" valign="top">
                <!--#企业列表-->
                <div>
                    <div class="xian">
                        <div class="about_title">
                            企业列表</div>
                        <div class="i-con-cn">
                        <div runat="server" id="divSearch">
                            <input type="button" class="xtbiao" onclick="AuditCorp(7)" value="解锁退回"  id="btnJsth" runat="server"/>
                            <input type="button" class="xtbiao" onclick="AuditCorp(6)" value="退回企业" id="btnTh"  runat="server"/>
                            <input type="button" class="xtbiao" onclick="AuditCorp(5)" value="审核企业"  runat="server" id="btnSh"/>
                            <%--<input type="button" class="xtbiao" onclick="CheckSel()" value="查看信息" />--%>
                            <input type="button" class="xtbiao" id="btnSeniorSearch" value="高级查询"/></div>
                            <input type="button" class="xtbiao" id="btnSearch" value="查询" />
                        </div>
                    </div>
                    <asp:Panel ID="Panel1" runat="server" Style="margin-bottom: 5px;">
                        <table style="width: 100%; height: 40px; padding-bottom: 10px; padding-top: 10px;
                            background-color: #eaeaea; text-align: center;">
                            <tr>
                                <td  style=" width:80px;">
                                    企业名称
                                </td>
                                <td  style=" width:150px;"> <asp:TextBox ID="txtCorpName" runat="server" Style="width: 150px; "></asp:TextBox>
                 
                                </td>
                                <td  style=" width:80px;">
                                    <asp:Literal ID="lblSh" runat="server">审核状态</asp:Literal>    
                                </td>
                                <td  style=" width:100px;">  <asp:DropDownList ID="ddlStatus" runat="server" Style="width: 100px;">
                                                </asp:DropDownList>
                                
                                </td>
                                <td>&nbsp;
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <telerik:RadGrid ID="ListCorps" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                        Width="100%" Culture="zh-CN" GridLines="None" AllowFilteringByColumn="false"
                        AllowPaging="true" AllowCustomPaging="true" AllowMultiRowSelection="true" OnNeedDataSource="ListCorps_NeedDataSource"
                        AllowSorting="false" ShowStatusBar="true">
                        <ClientSettings ReorderColumnsOnClient="True" AllowColumnsReorder="True" EnableRowHoverStyle="true">
                            <Resizing AllowRowResize="True" EnableRealTimeResize="True" ResizeGridOnColumnResize="True"
                                AllowColumnResize="True"></Resizing>
                        </ClientSettings>
                        <MasterTableView AutoGenerateColumns="false" DataKeyNames="ID">
                            <CommandItemSettings ExportToPdfText="导出PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                            </RowIndicatorColumn>
                            <Columns>
                                <telerik:GridTemplateColumn HeaderText="选择" HeaderStyle-Width="50px">
                                    <ItemTemplate>
                                        <input id="ckb" type="checkbox" value='<%#Eval("CorpUserGuid")+";"+Eval("Type")%>'
                                            runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle Width="50px"></ItemStyle>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn DataField="ID" HeaderText="ID" UniqueName="ID" ReadOnly="true"
                                    Visible="false">
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn DataField="CorpName" HeaderText="企业名称">
                                    <ItemTemplate>
                                        <a href="javascript:void(0);" onclick="ShowCorpView('<%#Eval("CorpUserGuid") %>')"
                                            title="点击查看企业信息"><span style="color: #43a9f5">
                                                <%#Eval("CorpName")%></span></a>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn DataField="Address" HeaderText="企业地址" ItemStyle-Width="100px">
                                    <ItemTemplate>
                                        <%#Eval("Address") == null ? "" : (Eval("Address").ToString().Length<15?Eval("Address").ToString():Eval("Address").ToString().Substring(0, 15))%>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn  HeaderText="企业类型" HeaderStyle-Width="100px">
                                    <ItemTemplate>
                                        <%#Eval("RoleId") == null ? "" : GetCorpClassKind(Eval("RoleId").ToString())%>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridTemplateColumn DataField="DetailName" HeaderText="主项资质" HeaderStyle-Width="200px">
                                    <ItemTemplate>
                                        <%#Eval("DetailName") == null ? "" : (Eval("GradeName") == null ? Eval("DetailName").ToString() : Eval("DetailName").ToString() + "-" + Eval("GradeName").ToString())%>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridBoundColumn DataField="LinkMan1" HeaderText="联系人" HeaderStyle-Width="60px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Tel" HeaderText="联系方式" HeaderStyle-Width="150px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="StrFlowCode" HeaderText="审核状态" HeaderStyle-Width="100px">
                                </telerik:GridBoundColumn>
                                  <telerik:GridTemplateColumn DataField="bCanBid" HeaderText="锁定" Visible="false">
                                    <ItemTemplate>
                                   <%-- <%#Eval("bCanBid")%>--%>
                                      <input type="button" class="xtbiao" onclick="SetCorpbCanBid(1,'<%#Eval("CorpUserGuid") %>')" value='<%#Eval("bCanBid")!=null && Eval("bCanBid").ToString().IndexOf("1")>=0?"锁定投标":"解锁投标" %>' />
                                       <input type="button" class="xtbiao" onclick="SetCorpbCanBid(2,'<%#Eval("CorpUserGuid") %>')" value='<%#Eval("bCanBid")!=null && Eval("bCanBid").ToString().IndexOf("2")>=0?"锁定考核":"解锁考核" %>' />
                                        <input type="button" class="xtbiao" onclick="SetCorpbCanBid(3,'<%#Eval("CorpUserGuid") %>')" value='<%#Eval("bCanBid")!=null && Eval("bCanBid").ToString().IndexOf("3")>=0?"锁定报表":"解锁报表" %>' />
                                    </ItemTemplate>
                                    </telerik:GridTemplateColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings EnableRowHoverStyle="true">
                        </ClientSettings>
                        <PagerStyle AlwaysVisible="True" />
                        <FilterMenu EnableImageSprites="False">
                        </FilterMenu>
                    </telerik:RadGrid>
                </div>
                <!--#企业列表结束-->
            </td>
            <td class="right_con">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td class="con_m tt_left_bottom">&nbsp;</td>
            <td colspan="2" class="con_m">&nbsp;</td>
            <td class="tt_right_bottom">&nbsp;</td>
        </tr>
    </table>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="WebBlue" EnableShadow="true">
    </telerik:RadWindowManager>
    <asp:HiddenField ID="hdnClassID" runat="server" />
    <asp:HiddenField ID="hdnCondition" runat="server" />
</asp:Content>
